﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using System.Xml.Serialization;
using System.Diagnostics;

namespace Zeus.DataTrans.XML.Serializer
{
    public class XmlSerObject<T>
    {
        private string filePath;

        public XmlSerObject(string filePath)
        {
            this.filePath = filePath;
        }

        public void Serialize(T instance)
        {
            using (XmlWriter writer = new XmlTextWriter(filePath, Encoding.UTF8))
            {
                XmlSerializer serializer = new XmlSerializer(typeof(T));
                serializer.Serialize(writer, instance);
            }

            Process.Start(filePath);
        }

    }
}
